/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListCamRegData {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Cam_reporte...");
		orm.Cam_reporte[] ormCam_reportes = lDAOFactory.getCam_reporteDAO().listCam_reporteByQuery(null, null);
		int length = Math.min(ormCam_reportes.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormCam_reportes[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Cam_tipo_reporte...");
		orm.Cam_tipo_reporte[] ormCam_tipo_reportes = lDAOFactory.getCam_tipo_reporteDAO().listCam_tipo_reporteByQuery(null, null);
		length = Math.min(ormCam_tipo_reportes.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormCam_tipo_reportes[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Cam_reporte by Criteria...");
		orm.Cam_reporteCriteria cam_reporteCriteria = new orm.Cam_reporteCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//cam_reporteCriteria.re_id_reporte.eq();
		cam_reporteCriteria.setMaxResults(ROW_COUNT);
		orm.Cam_reporte[] ormCam_reportes = cam_reporteCriteria.listCam_reporte();
		int length =ormCam_reportes== null ? 0 : Math.min(ormCam_reportes.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormCam_reportes[i]);
		}
		System.out.println(length + " Cam_reporte record(s) retrieved."); 
		
		System.out.println("Listing Cam_tipo_reporte by Criteria...");
		orm.Cam_tipo_reporteCriteria cam_tipo_reporteCriteria = new orm.Cam_tipo_reporteCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//cam_tipo_reporteCriteria.ti_id_tipo_reporte.eq();
		cam_tipo_reporteCriteria.setMaxResults(ROW_COUNT);
		orm.Cam_tipo_reporte[] ormCam_tipo_reportes = cam_tipo_reporteCriteria.listCam_tipo_reporte();
		length =ormCam_tipo_reportes== null ? 0 : Math.min(ormCam_tipo_reportes.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormCam_tipo_reportes[i]);
		}
		System.out.println(length + " Cam_tipo_reporte record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListCamRegData listCamRegData = new ListCamRegData();
			try {
				listCamRegData.listTestData();
				//listCamRegData.listByCriteria();
			}
			finally {
				orm.CamRegPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
